package com.campus.counseling.model.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.campus.counseling.entity.ChatSession;
import com.campus.counseling.model.dto.ChatSessionDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;

@Mapper
public interface ChatSessionMapper extends BaseMapper<ChatSession> {
    
    ChatSession selectByAppointmentId(@Param("appointmentId") Long appointmentId);
    
    List<ChatSession> selectActiveSessionsByUserId(@Param("userId") Long userId);
    
    void updateLastMessage(@Param("sessionId") Long sessionId, 
                          @Param("messageId") Long messageId);
    
    void incrementUnreadCount(@Param("sessionId") Long sessionId, 
                            @Param("isStudent") boolean isStudent);
    
    void clearUnreadCount(@Param("sessionId") Long sessionId, 
                         @Param("isStudent") boolean isStudent);

    List<ChatSessionDTO> selectActiveSessionsByCounselorId(@Param("counselorId") Long counselorId);
    List<ChatSessionDTO> selectActiveSessionsByStudentId(@Param("studentId") Long studentId);
} 